Number Properties


JavaScript provides several properties to work with numbers. These properties are part of the Number object and can be used to get information about numbers.

1. Number.EPSILON

The smallest interval between two representable numbers.

let epsilon = Number.EPSILON;
console.log(epsilon); // Outputs: 2.220446049250313e-16

2. Number.MAX_VALUE

The largest positive number that can be represented in JavaScript.

let maxValue = Number.MAX_VALUE;
console.log(maxValue); // Outputs: 1.7976931348623157e+308

3. Number.MIN_VALUE

The smallest positive number that can be represented in JavaScript.

let minValue = Number.MIN_VALUE;
console.log(minValue); // Outputs: 5e-324

4. Number.MAX_SAFE_INTEGER

The maximum safe integer in JavaScript (253 - 1).

let maxSafeInteger = Number.MAX_SAFE_INTEGER;
console.log(maxSafeInteger); // Outputs: 9007199254740991

5. Number.MIN_SAFE_INTEGER

The minimum safe integer in JavaScript (-(253 - 1)).

let minSafeInteger = Number.MIN_SAFE_INTEGER;
console.log(minSafeInteger); // Outputs: -9007199254740991

6. Number.POSITIVE_INFINITY

Represents positive infinity.

let positiveInfinity = Number.POSITIVE_INFINITY;
console.log(positiveInfinity); // Outputs: Infinity

7. Number.NEGATIVE_INFINITY

Represents negative infinity.

let negativeInfinity = Number.NEGATIVE_INFINITY;
console.log(negativeInfinity); // Outputs: -Infinity

8. Number.NaN

Represents a value that is "Not-a-Number".

let notANumber = Number.NaN;
console.log(notANumber); // Outputs: NaN